home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Amiga Plus Special 18
/
AMIGAplus Sonderheft 18 (1999)(ICP)(DE)[!].iso
/
Forum
/
MichaelRoth
/
3-3-99
/
code
/
code3
< prev
next >
Wrap
Text File
|
1998-08-15
|
6KB
|
219 lines
;// Autor
; %
; %%*%%
; %%%* *%%%
; %%%%* B *%%%%
; %%%%%* T *%%%%%
; %%%%%%* B *%%%%%%
; %%%%%%%* 1 *%%%%%%%
; %%%%%%%%* 3 *%%%%%%%%
; *%%%%%%%%%%* M *%%%%%%%%%%*
; %%%%%%%%%%%%*---------------*%%%%%%%%%%%%
; %% A M I G A %%
; %% B i l l y T h e B y t e %%
; %% © 1997 Michael Roth %%
; %%%%%%%%%%%%*---------------*%%%%%%%%%%%%
; *%%%%%%%%%%* D *%%%%%%%%%%*
; %%%%%%%%* A *%%%%%%%%
; %%%%%%%* C *%%%%%%%
; %%%%%%* 6 *%%%%%%
; %%%%%* 9 *%%%%%
; %%%%* 8 *%%%%
; %%%* *%%%
; %%*%%
; %
;\\
;// Include
Include assem:macro/Dir
Include assem:macro/Exec.m
Include assem:macro/Dos.m
Include Dos/DosExtens.i
include macro/filelength
;\\
;// Libraries öffnen
OpenDos 37
;\\
;//ReadArgs
move.l #inputstr,d1 ; Eingabe String
move.l #arry,d2 ; Arry
move.l #0,d3 ; Keine Externe Structur
Dos ReadArgs ; Argumente Lesen
move.l d0,rdargs ; speichern
bne.s .1 ; prüfen ob alles o.k.
error cleanup,20 ; o.k. >.1 Ansonsten Fehlermeldung beenden
.1 ;
lea arry,a0 ; Arry nach a0
;\\
;//File Öffnen und gröe bestimmen
move.l (a0),d1
move.l #MODE_OLDFILE,d2 ; 1005
Dos Open ; File Öffnen
bne.s .2
error cleanup,20
.2
move.l d0,fh
filelength fh,filelänge ; Filelänge bestimmen
;\\
;// Speicher Reservieren
move.l filelänge,d0
move.l #MEMF_CLEAR,d1
Exec AllocMem
move.l d0,memblock
bne.s .memallockok
error cleanup,20
.memallockok
;\\
;// File einlesen
move.l fh,d1
move.l memblock,d2
move.l filelänge,d3
Dos Read
cmp.l filelänge,d0
beq.s .readok
error cleanup,20
.readok
;\\
key
;//File Öffnen und gröe bestimmen
lea arry,a0 ; Arry nach a0
move.l 8(a0),d1
move.l #MODE_OLDFILE,d2 ; 1005
Dos Open ; File Öffnen
bne.s .2
error cleanup,20
.2
move.l d0,fh2
filelength fh2,filelänge2 ; Filelänge bestimmen
;\\
;// Speicher Reservieren
move.l filelänge2,d0
move.l #MEMF_CLEAR,d1
Exec AllocMem
move.l d0,memblock2
bne.s .memallockok
error cleanup,20
.memallockok
;\\
;// File einlesen
move.l fh2,d1
move.l memblock2,d2
move.l filelänge2,d3
Dos Read
cmp.l filelänge2,d0
beq.s .readok
error cleanup,20
.readok
;\\
code
;// Codieren
******************************************************************
move.l memblock,a0 ; Startadresse des Klartextes
move.l memblock2,a1 ; "" des Keys
move.l filelänge,d0 ; Länge des Buffers
move.l filelänge2,d1 ; Länge des Keys
lea (a0,d0),a2 ; Endadresse des Buffers berechnen
lea (a1,d1),a3 ; """" des Keys
.loop1
move.b (a1)+,d4
eor.b d4,(a0)+ ; XNOR bilden
cmp.l a1,a3 ; Prüfen ob Key am Ende
bhi.s .ggoon ; wenn nein weiter
move.l memblock2,a1 ; ansonsten neu laden
.ggoon ;
cmp.l a0,a2 ; Prüfen ob Buffer am Ende
bhi.s .loop1 ; Nein -> nächste schleife
********************************************************************
;\\
;// Zielfile Öffnen
lea arry,a0 ; Arry nach a0
move.l 4(a0),d1
move.l #MODE_NEWFILE,d2
Dos Open
move.l d0,d7
bne .ok
error cleanup,20
.ok
move.l d7,d1
move.l memblock,d2
move.l filelänge,d3
Dos Write
move.l d7,d1
Dos Close
;\\
;// CleanUp
cleanup
move.l rdargs,d1
beq.s .end ; Argumente da ?
Dos FreeArgs ; Wenn Nein beenden
move.l fh,d1
beq.s .1 ; File geöffnet
Dos Close ; Wenn nein weiter
.1
move.l memblock,d0
beq.s .2
move.l d0,a1
move.l filelänge,d0
Exec FreeMem
.2
move.l fh2,d1
beq.s .3 ; File geöffnet
Dos Close ; Wenn nein weiter
.3
move.l memblock2,d0
beq.s .4
move.l d0,a1
move.l filelänge2,d0
Exec FreeMem
.4
.end
closedos
moveq #0,d0
rts
;\\
;// Data
DATA
ver dc.b "$VER: V0 - Written by DAC698 - Michael Roth",0
inputstr
dc.b "Source/A,Dest/A,Key/A",0 ;KeyFile/S",0
cr
dc.b 10,0
BSS
cnop 0,4
arry ds.l 3
rdargs ds.l 1
fh ds.l 1
fh2 ds.l 1
filelänge
ds.l 1
memblock ds.l 1
filelänge2
ds.l 1
memblock2
ds.l 1
insert dc.b 4,0
;\\